import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './css/global.css'
const mock = require('../mock/mock')
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

const app = createApp(App)

// 全局挂载axios 
import axios from 'axios'
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'

// 去除警告

// axios请求拦截
axios.interceptors.request.use(
  config =>{
    // 为请求头对象,添加Token验证`Authorization`字段
    config.headers.Authorization = window.sessionStorage.getItem('token')
    return config
  }
)

app.config.globalProperties.$http = axios
app.config.productionTip = false





for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.use(store).use(router).use(mock).use(ElementPlus).mount('#app')
